# coding=utf-8

from gevent import monkey
import sys
from app import create_app

# 非阻塞模式
monkey.patch_all()

application = create_app(flask_config = 'development')

reload(sys)
sys.setdefaultencoding('utf8')

# 初始化状态
from app.modules.status.models import ApplyRecordStatus
from app.modules.status import STATUS

with application.app_context():
    _list = ApplyRecordStatus.query.all()
    for _status in _list:
        STATUS[_status.status] = _status.desc

if __name__ == '__main__':
    if application.config['socketio_app']:
        socketio_app = application.config['socketio_app']
        socketio_app.run(app = application, host = '0.0.0.0', port = 5002, debug = False)
    else:
        application.run(host = '0.0.0.0', port = 5002, debug = False)
